﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using DataDeal;
using Model;

namespace OMSWeb
{
    public partial class Default : System.Web.UI.Page
    {
        private DictionaryDAL _dal;
        private Dictionary _entity;

        protected void Page_Load(object sender, EventArgs e)
        {
            GridBind();
        }

        protected void btnSave_Click(object sender, EventArgs e)
        {
            _entity = new Dictionary();
            _entity.TypeId = "UserGrade";
            _entity.TypeName = "会员等级";
            _entity.Name = txtGrade.Text;
            _dal = new DictionaryDAL();
            _dal.Save(_entity);
            Common.Message.Show(this.Page, "保存成功！");
            GridBind();
        }

        private void GridBind()
        {
            _dal = new DictionaryDAL();
            IList<Dictionary> list = _dal.GetQueryByTypeId("UserGrade");
            if (list != null)
            {
                gvList.DataSource = list;
                gvList.DataBind();
            }
        }
    }
}
